# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2023/4/24 14:55
# @Author : xyjiang1216
# @Email : jiangxuyan@nudt.edu.cn
# @File : input.py
# @Version: OpenPlanner2.0
from z3 import Int

from OpenPlanner.core.api.algo_input_class import Link, Stream, Instance


class MacroLink(Link):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        if 'macrotick' in kwargs:
            self.macrotick = kwargs['macrotick']


class MacroStream(Stream):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.latency_requirement = kwargs['latency_requirement']


class MacroInstance(Instance):
    def __init__(self,
                 stream_id,
                 period_id,
                 link_id):
        super().__init__(stream_id,
                         period_id,
                         link_id)
        self.period_scaled_to_macrotick = None
        self.trans_duration_scaled_to_macrotick = None
        self.offset = Int(f'O_{stream_id}^({link_id})')
        self.prio = Int(f'P_{stream_id}^({link_id})')
